package com.dream.testtubebaby_doctor.data.product;

import java.io.Serializable;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class CarRentalListItemData implements Serializable{
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private long id;
	private String code;
	private String name;
	private String website;
	private String introduce;
	private String telephone;
	private String chinatelephone;
	private String sostelephone;
	private String agerequire;
	private String payrequire;
	private String rentalrequire;
	private String returnrequire;
	private String elserequire;
	private String pics[];
	private double price;
	private double point;
	private int commentcount;
	
	public double getPrice() {
		return price;
	}

	public void setPrice(double price) {
		this.price = price;
	}

	public double getPoint() {
		return point;
	}

	public void setPoint(double point) {
		this.point = point;
	}

	public int getCommentcount() {
		return commentcount;
	}

	public void setCommentcount(int commentcount) {
		this.commentcount = commentcount;
	}

	public long getId() {
		return id;
	}

	public void setId(long id) {
		this.id = id;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getWebsite() {
		return website;
	}

	public void setWebsite(String website) {
		this.website = website;
	}

	public String getIntroduce() {
		return introduce;
	}

	public void setIntroduce(String introduce) {
		this.introduce = introduce;
	}

	public String getTelephone() {
		return telephone;
	}

	public void setTelephone(String telephone) {
		this.telephone = telephone;
	}

	public String getChinatelephone() {
		return chinatelephone;
	}

	public void setChinatelephone(String chinatelephone) {
		this.chinatelephone = chinatelephone;
	}

	public String getSostelephone() {
		return sostelephone;
	}

	public void setSostelephone(String sostelephone) {
		this.sostelephone = sostelephone;
	}

	public String getAgerequire() {
		return agerequire;
	}

	public void setAgerequire(String agerequire) {
		this.agerequire = agerequire;
	}

	public String getPayrequire() {
		return payrequire;
	}

	public void setPayrequire(String payrequire) {
		this.payrequire = payrequire;
	}

	public String getRentalrequire() {
		return rentalrequire;
	}

	public void setRentalrequire(String rentalrequire) {
		this.rentalrequire = rentalrequire;
	}

	public String getReturnrequire() {
		return returnrequire;
	}

	public void setReturnrequire(String returnrequire) {
		this.returnrequire = returnrequire;
	}

	public String getElserequire() {
		return elserequire;
	}

	public void setElserequire(String elserequire) {
		this.elserequire = elserequire;
	}

	public String[] getPics() {
		return pics;
	}

	public void setPics(String[] pics) {
		this.pics = pics;
	}

	@Override
	public String toString() {
		return "ProductListItemData [id=" + id + ", code=" + code + ", name="
				+ name + ", website=" + website + ", introduce=" + introduce
				+ ", telephone=" + telephone + ", chinatelephone="
				+ chinatelephone + ", sostelephone=" + sostelephone
				+ ", agerequire=" + agerequire + ", payrequire=" + payrequire
				+ ", rentalrequire=" + rentalrequire + ", returnrequire="
				+ returnrequire + ", elserequire=" + elserequire + "]";
	}

	public static CarRentalListItemData getProductListItemDataNode(
			JSONObject jsonObject) {
		CarRentalListItemData data = new CarRentalListItemData();
		long id = 0;
		try {
			id = jsonObject.getLong("id");
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		String code = null;
		try {
			code = jsonObject.getString("code");
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		String name = null;
		try {
			name = jsonObject.getString("name");
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		String website = null;
		try {
			website = jsonObject.getString("website");
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		String introduce = null;
		try {
			introduce = jsonObject.getString("introduce");
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		String telephone = null;
		try {
			telephone = jsonObject.getString("telephone");
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		String chinatelephone = null;
		try {
			chinatelephone = jsonObject.getString("chinatelephone");
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		String sostelephone = null;
		try {
			sostelephone = jsonObject.getString("sostelephone");
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		String agerequire = null;
		try {
			agerequire = jsonObject.getString("agerequire");
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		String payrequire = null;
		try {
			payrequire = jsonObject.getString("payrequire");
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		String rentalrequire = null;
		try {
			rentalrequire = jsonObject.getString("rentalrequire");
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		String returnrequire = null;
		try {
			returnrequire = jsonObject.getString("returnrequire");
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		String elserequire = null;
		try {
			elserequire = jsonObject.getString("elserequire");
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		String []pics = null;
		try {
			JSONArray jsonBBS = new JSONArray(jsonObject.getString("pics"));
			pics = new String[jsonBBS.length()];
			for (int i = 0; i < jsonBBS.length(); i++) {
				String str = (String)jsonBBS.get(i);
				pics[i] = str;
			}
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		double price = 0;
		try {
			price = jsonObject.getDouble("price");
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		double point = 0;
		try {
			point = jsonObject.getDouble("point");
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		int commentcount = 0;
		try {
			commentcount = jsonObject.getInt("commentcount");
		} catch (JSONException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		data.setId(id);
		data.setCode(code);
		data.setName(name);
		data.setWebsite(website);
		data.setIntroduce(introduce);
		data.setTelephone(telephone);
		data.setChinatelephone(chinatelephone);
		data.setSostelephone(sostelephone);
		data.setAgerequire(agerequire);
		data.setPayrequire(payrequire);
		data.setRentalrequire(rentalrequire);
		data.setReturnrequire(returnrequire);
		data.setElserequire(elserequire);
		data.setPics(pics);
		data.setPrice(price);
		data.setPoint(point);
		data.setCommentcount(commentcount);
		return data;
	}
}
